package cn.edu.scau.cmi.hombio.web.rest;

import cn.edu.scau.cmi.hombio.dao.CureMedicineDAO;
import cn.edu.scau.cmi.hombio.dao.CureTaskMedicineDAO;
import cn.edu.scau.cmi.hombio.dao.MedicineDAO;
import cn.edu.scau.cmi.hombio.dao.MedicineStorageDetailDAO;
import cn.edu.scau.cmi.hombio.dao.MedicineSupplierDAO;
import cn.edu.scau.cmi.hombio.dao.MedicineTakeDetailDAO;
import cn.edu.scau.cmi.hombio.dao.PreventionTypeDAO;

import cn.edu.scau.cmi.hombio.domain.CureMedicine;
import cn.edu.scau.cmi.hombio.domain.CureTaskMedicine;
import cn.edu.scau.cmi.hombio.domain.Medicine;
import cn.edu.scau.cmi.hombio.domain.MedicineStorageDetail;
import cn.edu.scau.cmi.hombio.domain.MedicineSupplier;
import cn.edu.scau.cmi.hombio.domain.MedicineTakeDetail;
import cn.edu.scau.cmi.hombio.domain.PreventionType;

import cn.edu.scau.cmi.hombio.service.MedicineService;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Controller;

import org.springframework.web.bind.WebDataBinder;

import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Spring Rest controller that handles CRUD requests for Medicine entities
 * 
 */

@Controller("MedicineRestController")

public class MedicineRestController {

	/**
	 * DAO injected by Spring that manages CureMedicine entities
	 * 
	 */
	@Autowired
	private CureMedicineDAO cureMedicineDAO;

	/**
	 * DAO injected by Spring that manages CureTaskMedicine entities
	 * 
	 */
	@Autowired
	private CureTaskMedicineDAO cureTaskMedicineDAO;

	/**
	 * DAO injected by Spring that manages Medicine entities
	 * 
	 */
	@Autowired
	private MedicineDAO medicineDAO;

	/**
	 * DAO injected by Spring that manages MedicineStorageDetail entities
	 * 
	 */
	@Autowired
	private MedicineStorageDetailDAO medicineStorageDetailDAO;

	/**
	 * DAO injected by Spring that manages MedicineSupplier entities
	 * 
	 */
	@Autowired
	private MedicineSupplierDAO medicineSupplierDAO;

	/**
	 * DAO injected by Spring that manages MedicineTakeDetail entities
	 * 
	 */
	@Autowired
	private MedicineTakeDetailDAO medicineTakeDetailDAO;

	/**
	 * DAO injected by Spring that manages PreventionType entities
	 * 
	 */
	@Autowired
	private PreventionTypeDAO preventionTypeDAO;

	/**
	 * Service injected by Spring that provides CRUD operations for Medicine entities
	 * 
	 */
	@Autowired
	private MedicineService medicineService;

	/**
	 * Save an existing MedicineTakeDetail entity
	 * 
	 */
	@RequestMapping(value = "/Medicine/{medicine_id}/medicineTakeDetails", method = RequestMethod.PUT)
	@ResponseBody
	public MedicineTakeDetail saveMedicineMedicineTakeDetails(@PathVariable Integer medicine_id, @RequestBody MedicineTakeDetail medicinetakedetails) {
		medicineService.saveMedicineMedicineTakeDetails(medicine_id, medicinetakedetails);
		return medicineTakeDetailDAO.findMedicineTakeDetailByPrimaryKey(medicinetakedetails.getId());
	}

	/**
	* View an existing MedicineTakeDetail entity
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/medicineTakeDetails/{medicinetakedetail_id}", method = RequestMethod.GET)
	@ResponseBody
	public MedicineTakeDetail loadMedicineMedicineTakeDetails(@PathVariable Integer medicine_id, @PathVariable Integer related_medicinetakedetails_id) {
		MedicineTakeDetail medicinetakedetail = medicineTakeDetailDAO.findMedicineTakeDetailByPrimaryKey(related_medicinetakedetails_id, -1, -1);

		return medicinetakedetail;
	}

	/**
	* Show all MedicineStorageDetail entities by Medicine
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/medicineStorageDetails", method = RequestMethod.GET)
	@ResponseBody
	public List<MedicineStorageDetail> getMedicineMedicineStorageDetails(@PathVariable Integer medicine_id) {
		return new java.util.ArrayList<MedicineStorageDetail>(medicineDAO.findMedicineByPrimaryKey(medicine_id).getMedicineStorageDetails());
	}

	/**
	* Create a new CureTaskMedicine entity
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/cureTaskMedicines", method = RequestMethod.POST)
	@ResponseBody
	public CureTaskMedicine newMedicineCureTaskMedicines(@PathVariable Integer medicine_id, @RequestBody CureTaskMedicine curetaskmedicine) {
		medicineService.saveMedicineCureTaskMedicines(medicine_id, curetaskmedicine);
		return cureTaskMedicineDAO.findCureTaskMedicineByPrimaryKey(curetaskmedicine.getId());
	}

	/**
	* Register custom, context-specific property editors
	* 
	*/
	@InitBinder
	public void initBinder(WebDataBinder binder, HttpServletRequest request) { // Register static property editors.
		binder.registerCustomEditor(java.util.Calendar.class, new org.skyway.spring.util.databinding.CustomCalendarEditor());
		binder.registerCustomEditor(byte[].class, new org.springframework.web.multipart.support.ByteArrayMultipartFileEditor());
		binder.registerCustomEditor(boolean.class, new org.skyway.spring.util.databinding.EnhancedBooleanEditor(false));
		binder.registerCustomEditor(Boolean.class, new org.skyway.spring.util.databinding.EnhancedBooleanEditor(true));
		binder.registerCustomEditor(java.math.BigDecimal.class, new org.skyway.spring.util.databinding.NaNHandlingNumberEditor(java.math.BigDecimal.class, true));
		binder.registerCustomEditor(Integer.class, new org.skyway.spring.util.databinding.NaNHandlingNumberEditor(Integer.class, true));
		binder.registerCustomEditor(java.util.Date.class, new org.skyway.spring.util.databinding.CustomDateEditor());
		binder.registerCustomEditor(String.class, new org.skyway.spring.util.databinding.StringEditor());
		binder.registerCustomEditor(Long.class, new org.skyway.spring.util.databinding.NaNHandlingNumberEditor(Long.class, true));
		binder.registerCustomEditor(Double.class, new org.skyway.spring.util.databinding.NaNHandlingNumberEditor(Double.class, true));
	}

	/**
	* Save an existing Medicine entity
	* 
	*/
	@RequestMapping(value = "/Medicine", method = RequestMethod.PUT)
	@ResponseBody
	public Medicine saveMedicine(@RequestBody Medicine medicine) {
		medicineService.saveMedicine(medicine);
		return medicineDAO.findMedicineByPrimaryKey(medicine.getId());
	}

	/**
	* View an existing PreventionType entity
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/preventionTypesForReportMedicineId/{preventiontype_id}", method = RequestMethod.GET)
	@ResponseBody
	public PreventionType loadMedicinePreventionTypesForReportMedicineId(@PathVariable Integer medicine_id, @PathVariable Integer related_preventiontypesforreportmedicineid_id) {
		PreventionType preventiontype = preventionTypeDAO.findPreventionTypeByPrimaryKey(related_preventiontypesforreportmedicineid_id, -1, -1);

		return preventiontype;
	}

	/**
	* Delete an existing PreventionType entity
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/preventionTypesForMedicineId/{preventiontype_id}", method = RequestMethod.DELETE)
	@ResponseBody
	public void deleteMedicinePreventionTypesForMedicineId(@PathVariable Integer medicine_id, @PathVariable Integer related_preventiontypesformedicineid_id) {
		medicineService.deleteMedicinePreventionTypesForMedicineId(medicine_id, related_preventiontypesformedicineid_id);
	}

	/**
	* Show all CureTaskMedicine entities by Medicine
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/cureTaskMedicines", method = RequestMethod.GET)
	@ResponseBody
	public List<CureTaskMedicine> getMedicineCureTaskMedicines(@PathVariable Integer medicine_id) {
		return new java.util.ArrayList<CureTaskMedicine>(medicineDAO.findMedicineByPrimaryKey(medicine_id).getCureTaskMedicines());
	}

	/**
	* Save an existing PreventionType entity
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/preventionTypesForReportMedicineId", method = RequestMethod.PUT)
	@ResponseBody
	public PreventionType saveMedicinePreventionTypesForReportMedicineId(@PathVariable Integer medicine_id, @RequestBody PreventionType preventiontypesforreportmedicineid) {
		medicineService.saveMedicinePreventionTypesForReportMedicineId(medicine_id, preventiontypesforreportmedicineid);
		return preventionTypeDAO.findPreventionTypeByPrimaryKey(preventiontypesforreportmedicineid.getId());
	}

	/**
	* Delete an existing MedicineStorageDetail entity
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/medicineStorageDetails/{medicinestoragedetail_id}", method = RequestMethod.DELETE)
	@ResponseBody
	public void deleteMedicineMedicineStorageDetails(@PathVariable Integer medicine_id, @PathVariable Integer related_medicinestoragedetails_id) {
		medicineService.deleteMedicineMedicineStorageDetails(medicine_id, related_medicinestoragedetails_id);
	}

	/**
	* View an existing MedicineStorageDetail entity
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/medicineStorageDetails/{medicinestoragedetail_id}", method = RequestMethod.GET)
	@ResponseBody
	public MedicineStorageDetail loadMedicineMedicineStorageDetails(@PathVariable Integer medicine_id, @PathVariable Integer related_medicinestoragedetails_id) {
		MedicineStorageDetail medicinestoragedetail = medicineStorageDetailDAO.findMedicineStorageDetailByPrimaryKey(related_medicinestoragedetails_id, -1, -1);

		return medicinestoragedetail;
	}

	/**
	* Create a new CureMedicine entity
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/cureMedicines", method = RequestMethod.POST)
	@ResponseBody
	public CureMedicine newMedicineCureMedicines(@PathVariable Integer medicine_id, @RequestBody CureMedicine curemedicine) {
		medicineService.saveMedicineCureMedicines(medicine_id, curemedicine);
		return cureMedicineDAO.findCureMedicineByPrimaryKey(curemedicine.getId());
	}

	/**
	* Show all CureMedicine entities by Medicine
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/cureMedicines", method = RequestMethod.GET)
	@ResponseBody
	public List<CureMedicine> getMedicineCureMedicines(@PathVariable Integer medicine_id) {
		return new java.util.ArrayList<CureMedicine>(medicineDAO.findMedicineByPrimaryKey(medicine_id).getCureMedicines());
	}

	/**
	* Create a new MedicineStorageDetail entity
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/medicineStorageDetails", method = RequestMethod.POST)
	@ResponseBody
	public MedicineStorageDetail newMedicineMedicineStorageDetails(@PathVariable Integer medicine_id, @RequestBody MedicineStorageDetail medicinestoragedetail) {
		medicineService.saveMedicineMedicineStorageDetails(medicine_id, medicinestoragedetail);
		return medicineStorageDetailDAO.findMedicineStorageDetailByPrimaryKey(medicinestoragedetail.getId());
	}

	/**
	* Save an existing PreventionType entity
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/preventionTypesForMedicineId", method = RequestMethod.PUT)
	@ResponseBody
	public PreventionType saveMedicinePreventionTypesForMedicineId(@PathVariable Integer medicine_id, @RequestBody PreventionType preventiontypesformedicineid) {
		medicineService.saveMedicinePreventionTypesForMedicineId(medicine_id, preventiontypesformedicineid);
		return preventionTypeDAO.findPreventionTypeByPrimaryKey(preventiontypesformedicineid.getId());
	}

	/**
	* Save an existing CureMedicine entity
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/cureMedicines", method = RequestMethod.PUT)
	@ResponseBody
	public CureMedicine saveMedicineCureMedicines(@PathVariable Integer medicine_id, @RequestBody CureMedicine curemedicines) {
		medicineService.saveMedicineCureMedicines(medicine_id, curemedicines);
		return cureMedicineDAO.findCureMedicineByPrimaryKey(curemedicines.getId());
	}

	/**
	* Delete an existing CureTaskMedicine entity
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/cureTaskMedicines/{curetaskmedicine_id}", method = RequestMethod.DELETE)
	@ResponseBody
	public void deleteMedicineCureTaskMedicines(@PathVariable Integer medicine_id, @PathVariable Integer related_curetaskmedicines_id) {
		medicineService.deleteMedicineCureTaskMedicines(medicine_id, related_curetaskmedicines_id);
	}

	/**
	* Show all PreventionType entities by Medicine
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/preventionTypesForReportMedicineId", method = RequestMethod.GET)
	@ResponseBody
	public List<PreventionType> getMedicinePreventionTypesForReportMedicineId(@PathVariable Integer medicine_id) {
		return new java.util.ArrayList<PreventionType>(medicineDAO.findMedicineByPrimaryKey(medicine_id).getPreventionTypesForReportMedicineId());
	}

	/**
	* Delete an existing PreventionType entity
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/preventionTypesForReportMedicineId/{preventiontype_id}", method = RequestMethod.DELETE)
	@ResponseBody
	public void deleteMedicinePreventionTypesForReportMedicineId(@PathVariable Integer medicine_id, @PathVariable Integer related_preventiontypesforreportmedicineid_id) {
		medicineService.deleteMedicinePreventionTypesForReportMedicineId(medicine_id, related_preventiontypesforreportmedicineid_id);
	}

	/**
	* Save an existing MedicineSupplier entity
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/medicineSuppliers", method = RequestMethod.PUT)
	@ResponseBody
	public MedicineSupplier saveMedicineMedicineSuppliers(@PathVariable Integer medicine_id, @RequestBody MedicineSupplier medicinesuppliers) {
		medicineService.saveMedicineMedicineSuppliers(medicine_id, medicinesuppliers);
		return medicineSupplierDAO.findMedicineSupplierByPrimaryKey(medicinesuppliers.getId());
	}

	/**
	* View an existing CureTaskMedicine entity
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/cureTaskMedicines/{curetaskmedicine_id}", method = RequestMethod.GET)
	@ResponseBody
	public CureTaskMedicine loadMedicineCureTaskMedicines(@PathVariable Integer medicine_id, @PathVariable Integer related_curetaskmedicines_id) {
		CureTaskMedicine curetaskmedicine = cureTaskMedicineDAO.findCureTaskMedicineByPrimaryKey(related_curetaskmedicines_id, -1, -1);

		return curetaskmedicine;
	}

	/**
	* Show all PreventionType entities by Medicine
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/preventionTypesForMedicineId", method = RequestMethod.GET)
	@ResponseBody
	public List<PreventionType> getMedicinePreventionTypesForMedicineId(@PathVariable Integer medicine_id) {
		return new java.util.ArrayList<PreventionType>(medicineDAO.findMedicineByPrimaryKey(medicine_id).getPreventionTypesForMedicineId());
	}

	/**
	* Create a new MedicineTakeDetail entity
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/medicineTakeDetails", method = RequestMethod.POST)
	@ResponseBody
	public MedicineTakeDetail newMedicineMedicineTakeDetails(@PathVariable Integer medicine_id, @RequestBody MedicineTakeDetail medicinetakedetail) {
		medicineService.saveMedicineMedicineTakeDetails(medicine_id, medicinetakedetail);
		return medicineTakeDetailDAO.findMedicineTakeDetailByPrimaryKey(medicinetakedetail.getId());
	}

	/**
	* Delete an existing CureMedicine entity
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/cureMedicines/{curemedicine_id}", method = RequestMethod.DELETE)
	@ResponseBody
	public void deleteMedicineCureMedicines(@PathVariable Integer medicine_id, @PathVariable Integer related_curemedicines_id) {
		medicineService.deleteMedicineCureMedicines(medicine_id, related_curemedicines_id);
	}

	/**
	* Select an existing Medicine entity
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}", method = RequestMethod.GET)
	@ResponseBody
	public Medicine loadMedicine(@PathVariable Integer medicine_id) {
		return medicineDAO.findMedicineByPrimaryKey(medicine_id);
	}

	/**
	* Show all MedicineTakeDetail entities by Medicine
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/medicineTakeDetails", method = RequestMethod.GET)
	@ResponseBody
	public List<MedicineTakeDetail> getMedicineMedicineTakeDetails(@PathVariable Integer medicine_id) {
		return new java.util.ArrayList<MedicineTakeDetail>(medicineDAO.findMedicineByPrimaryKey(medicine_id).getMedicineTakeDetails());
	}

	/**
	* Create a new Medicine entity
	* 
	*/
	@RequestMapping(value = "/Medicine", method = RequestMethod.POST)
	@ResponseBody
	public Medicine newMedicine(@RequestBody Medicine medicine) {
		medicineService.saveMedicine(medicine);
		return medicineDAO.findMedicineByPrimaryKey(medicine.getId());
	}

	/**
	* Delete an existing MedicineSupplier entity
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/medicineSuppliers/{medicinesupplier_id}", method = RequestMethod.DELETE)
	@ResponseBody
	public void deleteMedicineMedicineSuppliers(@PathVariable Integer medicine_id, @PathVariable Integer related_medicinesuppliers_id) {
		medicineService.deleteMedicineMedicineSuppliers(medicine_id, related_medicinesuppliers_id);
	}

	/**
	* Delete an existing Medicine entity
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}", method = RequestMethod.DELETE)
	@ResponseBody
	public void deleteMedicine(@PathVariable Integer medicine_id) {
		Medicine medicine = medicineDAO.findMedicineByPrimaryKey(medicine_id);
		medicineService.deleteMedicine(medicine);
	}

	/**
	* Create a new PreventionType entity
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/preventionTypesForReportMedicineId", method = RequestMethod.POST)
	@ResponseBody
	public PreventionType newMedicinePreventionTypesForReportMedicineId(@PathVariable Integer medicine_id, @RequestBody PreventionType preventiontype) {
		medicineService.saveMedicinePreventionTypesForReportMedicineId(medicine_id, preventiontype);
		return preventionTypeDAO.findPreventionTypeByPrimaryKey(preventiontype.getId());
	}

	/**
	* View an existing PreventionType entity
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/preventionTypesForMedicineId/{preventiontype_id}", method = RequestMethod.GET)
	@ResponseBody
	public PreventionType loadMedicinePreventionTypesForMedicineId(@PathVariable Integer medicine_id, @PathVariable Integer related_preventiontypesformedicineid_id) {
		PreventionType preventiontype = preventionTypeDAO.findPreventionTypeByPrimaryKey(related_preventiontypesformedicineid_id, -1, -1);

		return preventiontype;
	}

	/**
	* Create a new PreventionType entity
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/preventionTypesForMedicineId", method = RequestMethod.POST)
	@ResponseBody
	public PreventionType newMedicinePreventionTypesForMedicineId(@PathVariable Integer medicine_id, @RequestBody PreventionType preventiontype) {
		medicineService.saveMedicinePreventionTypesForMedicineId(medicine_id, preventiontype);
		return preventionTypeDAO.findPreventionTypeByPrimaryKey(preventiontype.getId());
	}

	/**
	* View an existing CureMedicine entity
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/cureMedicines/{curemedicine_id}", method = RequestMethod.GET)
	@ResponseBody
	public CureMedicine loadMedicineCureMedicines(@PathVariable Integer medicine_id, @PathVariable Integer related_curemedicines_id) {
		CureMedicine curemedicine = cureMedicineDAO.findCureMedicineByPrimaryKey(related_curemedicines_id, -1, -1);

		return curemedicine;
	}

	/**
	* Create a new MedicineSupplier entity
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/medicineSuppliers", method = RequestMethod.POST)
	@ResponseBody
	public MedicineSupplier newMedicineMedicineSuppliers(@PathVariable Integer medicine_id, @RequestBody MedicineSupplier medicinesupplier) {
		medicineService.saveMedicineMedicineSuppliers(medicine_id, medicinesupplier);
		return medicineSupplierDAO.findMedicineSupplierByPrimaryKey(medicinesupplier.getId());
	}

	/**
	* Save an existing MedicineStorageDetail entity
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/medicineStorageDetails", method = RequestMethod.PUT)
	@ResponseBody
	public MedicineStorageDetail saveMedicineMedicineStorageDetails(@PathVariable Integer medicine_id, @RequestBody MedicineStorageDetail medicinestoragedetails) {
		medicineService.saveMedicineMedicineStorageDetails(medicine_id, medicinestoragedetails);
		return medicineStorageDetailDAO.findMedicineStorageDetailByPrimaryKey(medicinestoragedetails.getId());
	}

	/**
	* Save an existing CureTaskMedicine entity
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/cureTaskMedicines", method = RequestMethod.PUT)
	@ResponseBody
	public CureTaskMedicine saveMedicineCureTaskMedicines(@PathVariable Integer medicine_id, @RequestBody CureTaskMedicine curetaskmedicines) {
		medicineService.saveMedicineCureTaskMedicines(medicine_id, curetaskmedicines);
		return cureTaskMedicineDAO.findCureTaskMedicineByPrimaryKey(curetaskmedicines.getId());
	}

	/**
	* Show all MedicineSupplier entities by Medicine
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/medicineSuppliers", method = RequestMethod.GET)
	@ResponseBody
	public List<MedicineSupplier> getMedicineMedicineSuppliers(@PathVariable Integer medicine_id) {
		return new java.util.ArrayList<MedicineSupplier>(medicineDAO.findMedicineByPrimaryKey(medicine_id).getMedicineSuppliers());
	}

	/**
	* Show all Medicine entities
	* 
	*/
	@RequestMapping(value = "/Medicine", method = RequestMethod.GET)
	@ResponseBody
	public List<Medicine> listMedicines() {
		return new java.util.ArrayList<Medicine>(medicineService.loadMedicines());
	}

	/**
	* View an existing MedicineSupplier entity
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/medicineSuppliers/{medicinesupplier_id}", method = RequestMethod.GET)
	@ResponseBody
	public MedicineSupplier loadMedicineMedicineSuppliers(@PathVariable Integer medicine_id, @PathVariable Integer related_medicinesuppliers_id) {
		MedicineSupplier medicinesupplier = medicineSupplierDAO.findMedicineSupplierByPrimaryKey(related_medicinesuppliers_id, -1, -1);

		return medicinesupplier;
	}

	/**
	* Delete an existing MedicineTakeDetail entity
	* 
	*/
	@RequestMapping(value = "/Medicine/{medicine_id}/medicineTakeDetails/{medicinetakedetail_id}", method = RequestMethod.DELETE)
	@ResponseBody
	public void deleteMedicineMedicineTakeDetails(@PathVariable Integer medicine_id, @PathVariable Integer related_medicinetakedetails_id) {
		medicineService.deleteMedicineMedicineTakeDetails(medicine_id, related_medicinetakedetails_id);
	}
}